package cn.longge.service.impl;

import cn.longge.entity.WorkOrder;
import cn.longge.mapper.WorkOrderMapper;
import cn.longge.entity.Detail;
import cn.longge.entity.Transfer;
import cn.longge.mapper.DetailMapper;
import cn.longge.mapper.TransferMapper;
import cn.longge.service.IDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
@Transactional
public class DetailServiceImpl extends BaseServiceImpl<Detail> implements IDetailService {
    @Autowired
    private DetailMapper detailMapper;

    @Autowired
    private WorkOrderMapper workOrderMapper;

    @Autowired
    private TransferMapper transferMapper;

    @Override
    public Map<String, Object> selectDetail(int woId){
        Map<String,Object> resp = new HashMap<String,Object>();
        Detail detail = detailMapper.selectDetail(woId);
        WorkOrder workOrder = workOrderMapper.selectDetail(woId);
        List<Transfer> transfers = transferMapper.selectTransfer(woId);
        resp.put("detail",detail);
        resp.put("workDetail",workOrder);
        resp.put("transfer",transfers);
        return resp;
    }
}
